void obsluga_thingspeak() {
if ( ! ee.fl_ThingOn ) return;
if (WiFi.status() == WL_CONNECTED) {
if ( millis() > CzasDoTHINGSPEAK && rdORNOfull >= LICZBA_PYTAN_ORNO ) {
CzasDoTHINGSPEAK = millis() + Co_ILE_NA_THINGSPEAK + random( 0, 1000 );
printDebug( ANSI_PEN_YELLOW"\n\rSend Thingspeak..."ANSI_PEN_WHITE );
LedOn( LED_B );
LedOff( LED_SCK );
//-----
uint32_t tim = millis();
ThingSpeak.setField(1, (float)(WspolczynnikMocy) / 1000 );
ThingSpeak.setField(2, (float)MocCzynna );
ThingSpeak.setField(3, (float)MocBierna );
ThingSpeak.setField(4, (float)MocPozorna );
ThingSpeak.setField(5, (float)(Prad) / 1000 );
ThingSpeak.setField(6, (float)(Napiecie) / 100 );
ThingSpeak.setField(7, (float)(Czestotliwosc) / 100 );
if ( ip[3] == 52 ) {
ThingSpeak.writeFields(thingspeak_myChannelNumber, thingspeak_apiKey_sasedw);
}
else if ( ip[3] == 53 ) {
ThingSpeak.writeFields(thingspeak_myChannelNumber, thingspeak_apiKey_rmikliczniki);
}
else if ( ip[3] == 54 ) {
//todo: uzupelnic jak uzywany wykre
}
char txt[50];
sprintf( txt, " %dms", millis() - tim ); printDebug( txt );
}
LedBlink( LED_B, TIM_BLINK_RUN ); //----- Miganie diody RUN -----//
LedBlink( LED_SCK, TIM_BLINK_RUN ); //----- Miganie diody RUN -----//
}
}